
import { InMemoryDbService } from 'angular-in-memory-web-api';

import {HeroObject} from "./model/heroObject";

export class InMemoryDataService implements InMemoryDbService{
      createDb(){
        const herolist = [
          {id : 1, name : "寒冰射手", type : "ADC"},
          {id : 2, name : "暗夜猎手", type : "ADC"},
          {id : 3, name : "火蓝", type : "ADC"},
          {id : 4, name : "武器大师", type : "打野"},
          {id : 5, name : "光辉", type : "中单"},
          {id : 6, name : "小法", type : "中单"},
          {id : 7, name : "提莫队长", type : "法师"},
          {id : 8, name : "皮城女警", type : "ADC"},
          {id : 9, name : "韦鲁斯", type : "ADC"},
          {id : 10, name : "奶妈", type : "辅助"},
          {id : 11, name : "机器人", type : "辅助"},
          {id : 12, name : "牛头", type : "辅助"},
          {id : 13, name : "女坦", type : "辅助"},
          {id : 14, name : "沙漠死神", type : "上单"},
          {id : 15, name : "诺克萨斯之手", type : "上单"},
          {id : 16, name : "盖伦", type : "上单"},
          {id : 17, name : "皇子", type : "打野"},

        ];
        return {herolist};
      }


  genId(heroes: HeroObject[]): number {
    return heroes.length > 0 ? Math.max(...heroes.map(hero => hero.id)) + 1 : heroes.length;
  }
}
